package com.ytzlkaoshi.test4.controller;

import com.ytzlkaoshi.test4.pojo.BugDetail;
import com.ytzlkaoshi.test4.service.BugsdetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "bug管理模块")
@RestController
@RequestMapping("/deatil")
public class BugsdetailController {
    @Resource
    private BugsdetailService bugsdetailService;

    @PostMapping("/add")
    @ApiOperation("新增用户信息")
    public int insert(@RequestBody BugDetail bugsdetail){
      return   bugsdetailService.insert(bugsdetail);
    }

    @DeleteMapping("/del")
    @ApiOperation("删除用户信息")
    public int del(int id){
        return  bugsdetailService.delete(id);
    }
    @GetMapping("/query")
    @ApiOperation("查询全部用户信息")
    public List<BugDetail>query(){
        return bugsdetailService.selectAll(null);
    }
    @PutMapping("/upd")
    @ApiOperation("修改用户信息")
    public  int upd(@RequestBody BugDetail bugsdetail){
        return  bugsdetailService.update(bugsdetail);
    }
    @GetMapping("/getOne")
    @ApiOperation("查询单个用户信息")
    public  BugDetail getOne(int id){
        return bugsdetailService.selectOne(id);
    }

}
